package Phase2;

import java.io.Serializable;

/**
 * 
 * Class that contains a Node and an id that represent
 * a range of nodes
 * 
 * @author rpadilla
 *
 */
public class InsertionRange implements NodeOrRange, Serializable
{
	private static final long serialVersionUID = 1L;
	private Node upperBound;
	private int lowerBound;
	
	/**
	 * constructor
	 * @param id - identifier of a node that is the lower bound of the range
	 * @param upperBound - node that is the upper Bound of the range
	 * @pre id >= 0 AND upperBound != null
	 * @post this.id = id, this.upperBound = upperBound
	 */
	public InsertionRange(int id, Node upperBound)
	{
		this.lowerBound = id;
		this.upperBound = upperBound;
	}
	
	/**
	 * upperBound Setter
	 * @param n - Node to be assigned to the upper Bound
	 * @pre None
	 * @post this.upperBound = n
	 */
	public void setUpperBound(Node n)
	{
		upperBound = n;
	}
	
	/**
	 * lowerBound Setter
	 * @param n - Integer to be assigned to the lower Bound
	 * @pre None
	 * @post this.lowerBound = n
	 * 
	 */
	public void setLowerBound(int n)
	{
		lowerBound = n;
	}
	
	/**
	 * upperBound Getter
	 * @return
	 * The upperBound as a Node
	 * @pre None
	 * @post resut = upperBound
	 */
	public Node getUpperBound()
	{
		return upperBound;
	}
	
	/**
	 * lowerBound Getter
	 * @return
	 * The lowerBound as an Integer
	 * @pre None
	 * @post result = lowerBound
	 */
	public int getLowerBound()
	{
		return lowerBound;
	}
	 
/*	 
	/**
	 * Returns the string value of this InsertionRange
	 * @return a string representation of this InsertionRange
	 * @pre None
	 * @post return a string representation of this range 
	 * @see java.lang.Object#toString() 
	 */
/*
	public String toString()
	{
		String result = new String();
		result += "InsertionRange:";
		
		for(int i = lowerBound; i <= upperBound.getId(); i++)
		{
			result += "[" + Integer.toBinaryString(i) + "]";
		} 
		return result;
		
	}
*/
}
